package br.com.danilloguimaraes.persistence;

import br.com.danilloguimaraes.utils.Utils;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;

/**
 *
 * @author Danillo
 */
public class Manager {

    private static EntityManager em = null;
    
    public Manager(){
        if(Utils.isNull(em)){
            em = Persistence.createEntityManagerFactory("veiculospu").
                    createEntityManager();
        }
    }
    
    public Manager(String pu){
        if(Utils.isNull(em)){
            em = Persistence.createEntityManagerFactory(pu).
                    createEntityManager();
        }
    }
    
    public EntityManager getEntityManager(){
        return em;
    }
}
